package com.sgcc.manager.sql.util;

import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.List;

/**
 * 列表输出流类
 * @author liubin
 * @since 2012-7-26
 */
public class ListPrintWriter extends PrintWriter {
	
    public ListPrintWriter() {
        super(new StringWriter());
    }

    public ListPrintWriter(int initialSize) {
        super(new ListPrintWriter(initialSize));
    }
    
    @Override
    public void write(String s) {
    	this.list.add(s);
    }
    
    /**
     * 获取列表
     * @return List<String> 字符串列表
     */
    public List<String> getList() {
        this.flush();
        return list;
    }
    
	List<String> list = new ArrayList<String>();
}
